﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using SolrNet.Attributes;
using NCT.Framework;

namespace VISS.API.Users {
    public class SolrUserIdxEnt {

        #region Properties

        [SolrField("UserKey")]
        public string UserKey { get; set; }
        [SolrField("Name")]
        public string Name { get; set; }
        [SolrField("Gender")]
        public EUserGender Gender { get; set; }
        [SolrField("BirthDate")]
        public DateTime BirthDate { get; set; }
        [SolrField("CityID")]
        public short CityID { get; set; }
        [SolrField("City")]
        public string City { get; set; }
        [SolrField("CountryID")]
        public short CountryID { get; set; }
        [SolrField("Country")]
        public string Country { get; set; }
        [SolrField("EducationID")]
        public short EducationID { get; set; }
        [SolrField("Education")]
        public string Education { get; set; }
        [SolrField("JobID")]
        public short JobID { get; set; }
        [SolrField("Job")]
        public string Job { get; set; }
        [SolrField("LookingFor")]
        public EUserLookingFor LookingFor { get; set; }
        [SolrField("ImageCount")]
        public int ImageCount { get; set; }
        [SolrField("Blast")]
        public string Blast { get; set; }

        /// <summary>
        /// This field will not be indexed
        /// </summary>
        public byte Age { get; set; }

        #endregion

        #region Constructors

        public SolrUserIdxEnt() {
            UserKey = string.Empty;
            Name = string.Empty;
            Gender = EUserGender.Male;
            BirthDate = DateTimeUtils.MinValue;
            Age = 0;
            CityID = 0;
            City = string.Empty;
            CountryID = 0;
            Country = string.Empty;
            EducationID = 0;
            Education = string.Empty;
            JobID = 0;
            Job = string.Empty;
            LookingFor = EUserLookingFor.All;
            ImageCount = 0;
            Blast = string.Empty;
        }

        #endregion

        #region Static Methods

        public static SolrUserIdxEnt FromUserGeneralProfileEnt(UserGeneralProfileEnt gItem) {
            SolrUserIdxEnt item = new SolrUserIdxEnt();

            item.UserKey = gItem.UserKey;
            item.Name = gItem.Name;
            item.Gender = gItem.Gender;
            item.BirthDate = gItem.BirthDate;
            item.CityID = gItem.CityID;
            item.City = gItem.City;
            item.CountryID = gItem.CountryID;
            item.Country = gItem.Country;
            item.EducationID = gItem.EducationID;
            item.Education = gItem.Education;
            item.JobID = gItem.JobID;
            item.Job = gItem.Job;
            item.LookingFor = gItem.LookingFor;
            item.ImageCount = gItem.ImageCount;
            item.Blast = gItem.Blast;

            return item;
        }

        #endregion

    }
}
